<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8" />
	<title>{$Think.lang.art_add_page_title} - {$Think.lang.cfg_website}</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<!-- BEGIN GLOBAL MANDATORY STYLES -->
	<link href="{$NOW_THEME_URL}/Assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/plugins/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/css/style-metro.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="{$NOW_THEME_URL}/Assets/css/themes/{:session('skin')}.css" rel="stylesheet" type="text/css" id="style_color"/>
	<!-- END GLOBAL MANDATORY STYLES -->
	<!-- BEGIN PAGE LEVEL STYLES -->
	<!-- END PAGE LEVEL STYLES -->
	<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN HEADER -->
	<include file="Public:header" />
	<!-- END HEADER -->
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<!-- BEGIN SIDEBAR -->
		<div class="page-sidebar nav-collapse collapse">
			<!-- BEGIN SIDEBAR MENU -->        
			<ul class="page-sidebar-menu">
            	<li>
					<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
					<div class="sidebar-toggler hidden-phone"></div>
					<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
				</li>
               {$menu_tree}
            </ul>
			<!-- END SIDEBAR MENU -->
		</div>
		<!-- END SIDEBAR -->
		<!-- BEGIN PAGE -->
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div id="portlet-config" class="modal hide">
				<div class="modal-header">
					<button data-dismiss="modal" class="close" type="button"></button>
					<h3>portlet Settings</h3>
				</div>
				<div class="modal-body">
					<p>Here will be a configuration form</p>
			  </div>
			</div>
			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- BEGIN PAGE CONTAINER-->
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->   
			  <div class="row-fluid">
					<div class="span12">
                    	<div class="clear">&nbsp;</div>                        
						<ul class="breadcrumb">
							<li>
								<i class="icon-home"></i>
								<a href="__APP__">{$Think.lang.cfg_page_home}</a> 
								<span class="icon-angle-right"></span>
							</li>
							<li>
								<a href="__URL__">{$Think.lang.art_page_title}</a> 
								<span class="icon-angle-right"></span>
						  </li>
							<li><a href="#">{$Think.lang.art_add_page_title}</a></li>
						</ul>
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div class="row-fluid">
					<div class="span12">
						<!-- BEGIN VALIDATION STATES-->
						<div class="portlet box purple">
							<div class="portlet-title">
								<div class="caption"><i class="icon-plus"></i>{$Think.lang.art_add_page_title}</div>
								<div class="tools">
									<a href="javascript:;" class="collapse"></a>
								</div>
							</div>
							<div class="portlet-body form">
								<!-- BEGIN FORM-->
    <form action="__URL__/form" method="post" id="adcontentForm" 
    class="form-horizontal form-bordered form-row-stripped">
    <input type="hidden" name="solevar" value="{:create_id()}"/>
      <div class="alert alert-error hide">
          <button class="close" data-dismiss="alert"></button>
          {$Think.lang.cfg_form_err_allform}
      </div>
      <div class="alert alert-success hide">
          <button class="close" data-dismiss="alert"></button>
          {$Think.lang.cfg_form_ok_allform}
      </div>
      <div class="tabbable tabbable-custom">
          <ul class="nav nav-tabs">
              <li class="active">
                  <a href="#tab_1_1" data-toggle="tab">
                      {$Think.lang.art_form_tab_article}
                  </a>
              </li>
              <li>
                  <a href="#tab_1_2" data-toggle="tab">
                      {$Think.lang.cfg_form_tab_wechat_reply}
                  </a>
              </li>
          </ul>
          <div class="tab-content">
              <!--tab1 start-->
              <div class="tab-pane active" id="tab_1_1">
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_lang}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <select class="span6 m-wrap" name="lang">
                              <option value="">{$Think.lang.cfg_form_tis_select}</option>
                              {$lang}
                          </select>
                      </div>
                  </div>
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_cate_id}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <select class="span6 m-wrap" name="cateid">
                          <option value="">{$Think.lang.cfg_form_tis_select}</option>
                          {$selects}
                          </select>
                      </div>
                  </div>                                            
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_title}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <input type="text" name="title" data-required="1" 
                           class="span6 m-wrap" placeholder="{$Think.lang.art_form_ele_title_tip}"/>
                      </div>
                  </div>
                  
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_writer}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <input type="text" name="writer" data-required="1" class="span6 m-wrap"
                           placeholder="{$Think.lang.art_form_ele_writer_tip}"/>
                      </div>
                  </div>
                  
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_source}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <input type="text" name="source" data-required="1" class="span6 m-wrap" 
                           placeholder="{$Think.lang.art_form_ele_source_tip}"/>
                      </div>
                  </div>
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.cfg_upl_thumbpic}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <a class="btn blue" id="uploadSinglePic" data-toggle="modal">
                          <i class="icon-picture"></i> <?=L('cfg_upl_thumbpic_btn')?></a>
                          <div class="clear" style="height:20px;"></div>
                              <div class="alert">
                              <button data-dismiss="alert" class="close"></button>
                              {$Think.lang.cfg_upl_thumbpic_wx_tis}
                              </div>
                          <div class="clear"></div>
                          <div id="singleBox" class="uploadPic_box"></div>
                      </div>
                  </div>
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_keywords}
                      <span class="required">*</span></label>
                      <div class="controls">
                          <input type="text" name="keywords" data-required="1" class="span6 m-wrap"
                           placeholder="{$Think.lang.art_form_ele_keywords_tip}"/>
                      </div>
                  </div>
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_description}</label>
                      <div class="controls">
                        <textarea name="description" style="width:60%; height:120px;"></textarea>
                      </div>
                  </div>
                  
                  <div class="control-group">
                      <label class="control-label">{$Think.lang.art_form_ele_content}</label>
                      <div class="controls">
                        <textarea name="content" style="width:100%; height:400px;"></textarea>
                      </div>
                  </div>                                  
              </div>
              <!--tab1 end-->
              <!--tab2 start-->
              <div class="tab-pane" id="tab_1_2">
                  <div class="row-fluid">
                    <div class="span6">
                      <button type="button" id="btn_addReply" class="btn blue">
                          <i class="icon-plus"></i>
                          {$Think.lang.cfg_form_wechat_reply_add}
                      </button>
                      <button type="button" id="btn_refresh" class="btn green  icn-only">
                      <i class="icon-refresh"></i>
                      </button>
                    </div>
                  </div>
                  <div class="clear" style="height:10px;"></div>
                  <table class="table table-striped table-bordered table-hover 
                         table-condensed flip-content">
                      <thead>					
                      <tr class="list_head ct" style="text-align:center">
                        <td>{$Think.lang.cfg_form_reply_type}</td>
                        <td>{$Think.lang.cfg_form_wechat_reply_type}</td>
                        <td >{$Think.lang.cfg_form_wechat_reply_explain}</td>
                        <td>{$Think.lang.cfg_form_ele_opreate}</td>
                      </tr>
                      </thead>
                      <tbody id="tableList">
                      
                      </tbody>
                  </table>
                  
                  
              </div>
              <!--tab2 end-->
          </div>
      </div>
      <div class="form-actions">
          <button type="submit" class="btn purple">{$Think.lang.cfg_form_ele_submit}</button>
          <button type="reset" class="btn">{$Think.lang.cfg_form_ele_reset}</button>
      </div>
    </form>
								<!-- END FORM-->
							</div>
						</div>
						<!-- END VALIDATION STATES-->
					</div>
				</div>
				<!-- END PAGE CONTENT-->         
		  </div>
			<!-- END PAGE CONTAINER-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<include file="Public:footer" />
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->
	<script src="__PUBLIC__/Js/jquery.min.js" type="text/javascript"></script>
	<script src="{$NOW_THEME_URL}/Assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>   
	<script src="{$NOW_THEME_URL}/Assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<!--[if lt IE 9]>
	<script src="{$NOW_THEME_URL}/Assets/plugins/excanvas.min.js"></script>
	<script src="{$NOW_THEME_URL}/Assets/plugins/respond.min.js"></script>  
	<![endif]-->  
	<script src="{$NOW_THEME_URL}/Assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<!-- END CORE PLUGINS -->
    
    <!-- BEGIN UPLOADPIC-->
    <script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/artdialog/jquery.artdialog.js?skin=bootstrap"></script>
	<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/artdialog/plugins/iframeTools.js"></script>
    <!-- END UPLOADPIC-->
    
	<!-- BEGIN PAGE LEVEL PLUGINS -->
	<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
    <script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/jquery-validation/localization/messages_{$Think.LANG_SET}.js"></script>
	<!-- END PAGE LEVEL PLUGINS -->
  
    <!-- BEGIN XHEDITOR-->
    <script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/xheditor/xheditor-1.2.1.min.js"></script>
    <script type="text/javascript" src="{$NOW_THEME_URL}/Assets/plugins/xheditor/xheditor_lang/{$Think.LANG_SET}.js"></script>
    <!-- END XHEDITOR-->
    
    <!-- BEGIN PAGE LEVEL STYLES -->
	<script src="{$NOW_THEME_URL}/Assets/scripts/app.js"></script>
	<script src="{$NOW_THEME_URL}/Assets/scripts/article/add.js"></script> 
    <script src="{$NOW_THEME_URL}/Assets/scripts/upload/pic.js"></script>
    <script src="{$NOW_THEME_URL}/Assets/scripts/wechat/list.js"></script>
	<!-- END PAGE LEVEL STYLES -->    
	<script type="text/javascript">
		var ABS_URL_Theme = "{$NOW_THEME_URL}/";
		//UploadPic STATES CONSTANT
		var ABS_URL = "{$Think.TMPL_URL}/";
		var REL_URL = "{$Think.REL_URL}";
		//UploadPic END CONSTANT
		
		var vMessage = {};
		//用户添加表单的验证提示语言包
		vMessage.title_required       = '{$Think.lang.art_form_validata_title_required}';
		vMessage.title_regex          = '{$Think.lang.art_form_validata_title_regex}';
		vMessage.writer_required      = '{$Think.lang.art_form_validata_writer_required}';
		vMessage.source_required      = '{$Think.lang.art_form_validata_source_required}';
		vMessage.keywords_required    = '{$Think.lang.art_form_validata_keywords_required}';
		vMessage.keywords_regex       = '{$Think.lang.art_form_validata_keywords_regex}';
		vMessage.description_required = '{$Think.lang.art_form_validata_description_required}';
		vMessage.description_regex    = '{$Think.lang.art_form_validata_description_regex}';
		
		var jsLang = {};
		jsLang.crop_title      = '{:L("cfg_upl_crop_title")}';
		jsLang.crop_false      = '{:L("cfg_upl_crop_false")}';
		jsLang.crop_noselect   = '{:L("cfg_upl_crop_noselect")}';
		jsLang.uploadSinglePic = '{:L("cfg_upl_thumbpic_btn")}';
		jsLang.uploadAtlasPic  = '{:L("cfg_upl_atlaspic_btn")}';
		jsLang.uploadScan      = '{:L("cfg_upl_scan")}';
		
		jQuery(document).ready(function() {

		   App.init();
		   adcontentForm.init();
		   
		    get_select();
		   $('select[name=lang]').bind('change',function(){
			  get_select();
		   });
		   
		   // initiate xheditor
		   $('textarea[name="content"]').xheditor({modalWidth:650,modalHeight:400,upBtnText:jsLang.uploadScan,upLinkUrl:"!{$NOW_THEME_URL}/Assets/plugins/ckfinder/upload.html?type=File",upImgUrl:"!{$NOW_THEME_URL}/Assets/plugins/ckfinder/upload.html?type=Photo",upFlashUrl:"!{$NOW_THEME_URL}/Assets/plugins/ckfinder/upload.html?type=Flash",upMediaUrl:"!{$NOW_THEME_URL}/Assets/plugins/ckfinder/upload.html?type=Media"});
		   
		   uploadPic.init([
				{
					'btn':'uploadSinglePic',
					'title':jsLang.uploadSinglePic,
					'box':'singleBox',
					'ptype':'single',
					'field':'single'
				},
				{
					'btn':'uploadAtlasPic',
					'title':jsLang.uploadAtlasPic,
					'box':'atlasBox',
					'ptype':'atlas',
					'field':'atlas'
				}
			],jsLang);
			
			$('#btn_addReply').on('click',function(){
				name =  "{$Think.lang.cfg_form_wechat_reply_add}";
				var table   = 'Article';
				var solevar = $('input[name=solevar]').val(); 
				art.dialog.open('{:U("/Reply/content_add")}'+'&solevar='+solevar+'&table='+table,
				{title: name, width:600,height:420,fixed:true,top:60});
			});
			
			$('#btn_refresh').on('click',function(){
				getListReply();
			});
			
			$('.delAlone').live('click',function(){
				$.get('{:U("/Reply/delcont")}'+'&id='+$(this).attr('data-id'));
				getListReply();
			});
			
		});
		
		function getListReply(){
			$('#tableList').html('<tr><td colspan="3"><div id="ajaxLoadingIco" style="text-align:center;padding:20px;">'+
								 '<img src="'+ABS_URL_Theme+'/Assets/img/ajax-loading.gif"/></div></td></tr>');
			
			var solevar = $('input[name=solevar]').val(); 
			var parameter = {};
			parameter.url = '{:U("/Reply/content_reply")}'+'&solevar='+solevar;
			parameter.listId = 'tableList';
			wechatList.init(parameter);		
		}
		
		function get_select(){
			 var module = 'Article';
			 var lang   = $("select[name=lang]").val();
			 $.get('{:U("Public/ajax")}', {'lang':lang,'module':module}, function(data){
				var option = "<option value='0'>{$Think.lang.cfg_form_tis_select}</option>";
				$("select[name=cateid]").html(option+data);	
			});
		}
	</script>
	<!-- END JAVASCRIPTS -->   
</body>
<!-- END BODY -->
</html>